<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>数据可视化</title>
  <link rel="stylesheet" href="../lib/OSL/bootstrap.css" />
  <link rel="stylesheet" href="../lib/OSL/main.css" />
  <script src="../lib/OSL/jquery.js"></script>
  <script type="text/javascript" src="../lib/OSL/echarts.min.js"></script>

  <style>
    .pie4{
      height: 1000px !important; /* 增加容器高度 */
    }
  </style>
</head>

<body>
  <div class="container-fluid">
    <div class="row spannel_list">
      <div class="col-sm-12 col-xs-6">
        <div class="spannel">
        </div>
      </div>
    </div>
  </div>

  <div class="container-fluid ">
    <div class="row curve-pie ">
      <div class="col-lg-8 col-md-8 ">
        <div class="gragh_pannel pie4" id="curve_show"></div>
      </div>
      <div class="col-lg-4 col-md-4">
        <div class="gragh_pannel pie4" id="pie_show"></div>
      </div>
    </div>
  </div>
  <script>
    var oColumn = this.echarts.init(document.getElementById('curve_show'));
    var oColumnopt = {
      title: {
        text: '2025年宿舍用电量',
        left: 'center',
        top: '10'
      },
      tooltip: {
        trigger: 'axis'
      },
      legend: {
        data: ['明德楼202', '慧远楼201', '明德楼301', '慧远楼203'],
        top: '40'
      },
      toolbox: {
        show: true,
        feature: {
          mark: {
            show: true
          },
          dataView: {
            show: true,
            readOnly: false
          },
          magicType: {
            show: true,
            type: ['line', 'bar']
          },
          restore: {
            show: true
          },
          saveAsImage: {
            show: true
          }
        }
      },
      calculable: true,
      xAxis: [{
        type: 'category',
        data: ['1月', '2月', '3月', '4月', '5月']
      }],
      yAxis: [{
        name: '用电量',
        type: 'value'
      }],
      series: [{
          name: '明德楼202',
          type: 'bar',
          barWidth: 20,
          itemStyle: {
            normal: {
              areaStyle: {
                type: 'default'
              },
              color: '#fd956a'
            }
          },
          data: [800, 708, 920, 1090, 1200]
        },
        {
          name: '慧远楼201',
          type: 'bar',
          barWidth: 20,
          itemStyle: {
            normal: {
              areaStyle: {
                type: 'default'
              },
              color: '#2bb6db'
            }
          },
          data: [400, 468, 520, 690, 800]
        },
        {
          name: '明德楼301',
          type: 'bar',
          barWidth: 20,
          itemStyle: {
            normal: {
              areaStyle: {
                type: 'default'
              },
              color: '#13cfd5'
            }
          },
          data: [500, 668, 520, 790, 900]
        },
        {
          name: '慧远楼203',
          type: 'bar',
          barWidth: 20,
          itemStyle: {
            normal: {
              areaStyle: {
                type: 'default'
              },
              color: '#00ce68'
            }
          },
          data: [600, 508, 720, 890, 1000]
        }
      ],
      grid: {
        show: true,
        x: 50,
        x2: 30,
        y: 80,
        height: 800
      },
      dataZoom: [ //给x轴设置滚动条
        {
          start: 0, //默认为0
          end: 100 - 1000 / 31, //默认为100
          type: 'slider',
          show: true,
          xAxisIndex: [0],
          handleSize: 0, //滑动条的 左右2个滑动条的大小
          height: 8, //组件高度
          left: 45, //左边的距离
          right: 50, //右边的距离
          bottom: 26, //右边的距离
          handleColor: '#ddd', //h滑动图标的颜色
          handleStyle: {
            borderColor: "#cacaca",
            borderWidth: "1",
            shadowBlur: 2,
            background: "#ddd",
            shadowColor: "#ddd",
          }
        }
      ]
    };
    oColumn.setOption(oColumnopt);
    


    var oPie = echarts.init(document.getElementById('pie_show'));
    var oPieopt = {
      title: {
        top: 10,
        text: '宿舍报修分析',
        x: 'center'
      },
      tooltip: {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
      },
      color: ['#5885e8', '#13cfd5', '#00ce68', '#ff9565','#00BFFF','#DAA520','#BEBEBE'],
      legend: {
        x: 'center',
        top: 65,
        data: ['水电类', '五金类', '墙面和地面', '卫生设施','电器类','网络类','其他']
      },
      toolbox: {
        show: true,
        x: 'center',
        top: 35,
        feature: {
          mark: {
            show: true
          },
          dataView: {
            show: true,
            readOnly: false
          },
          magicType: {
            show: true,
            type: ['pie', 'funnel'],
            option: {
              funnel: {
                x: '25%',
                width: '50%',
                funnelAlign: 'left',
                max: 1548
              }
            }
          },
          restore: {
            show: true
          },
          saveAsImage: {
            show: true
          }
        }
      },
      calculable: true,
      series: [{
        name: '访问来源',
        type: 'pie',
        radius: ['45%', '60%'],
        center: ['50%', '65%'],
        data: [{
            value: 300,
            name: '水电类'
          },
          {
            value: 100,
            name: '五金类'
          },
          {
            value: 260,
            name: '墙面和地面'
          },
          {
            value: 180,
            name: '卫生设施'
          }
          ,
          {
            value: 180,
            name: '电器类'
          }
          ,
          {
            value: 180,
            name: '网络类'
          }
          ,
          {
            value: 180,
            name: '其他'
          }
        ]
      }]
    };
    oPie.setOption(oPieopt);
  </script>
</body>

</html>